<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7">
 <TITLE>SDCC Compiler User Guide: Command Line options</TITLE>
 <LINK HREF="SDCCUdoc-5.html" REL=next>
 <LINK HREF="SDCCUdoc-3.html" REL=previous>
 <LINK HREF="SDCCUdoc.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="SDCCUdoc-5.html">Next</A>
<A HREF="SDCCUdoc-3.html">Previous</A>
<A HREF="SDCCUdoc.html#toc4">Contents</A>
<HR>
<H2><A NAME="Command Line Options"></A> <A NAME="s4">4. Command Line options</A> </H2>

<P>
<UL>
<LI><B>--model-large
<A NAME="--model-large"></A> </B> Generate code for Large model programs see section Memory
Models for more details. If this option is used all source files in the project
should be compiled with this option. In addition the standard library routines
are compiled with small model , they will need to be recompiled.</LI>
<LI><B>--model-small</B> 
<A NAME="--model-small"></A> Generate code for Small Model programs see section Memory
Models for more details. This is the default model.</LI>
<LI><B>--model-flat24</B> 
<A HREF="SDCCUdoc-17.html#--model-flat24">--model-flat24</A>Generate code for Small Model programs see section Memory
Models for more details. This is the default model.</LI>
<LI><B>--stack-auto</B> 
<A NAME="--stack-auto"></A> All functions in the source file will be compiled as reentrant,
i.e. the parameters and local variables will be allocated on the stack. see
section Parameters and Local Variables for more details. If this option is
used all source files in the project should be compiled with this option. </LI>
<LI><B>--xstack</B>
<A NAME="--xstack"></A>  Uses a pseudo stack in the first 256 bytes in the external ram
for allocating variables and passing parameters. See section on external stack
for more details.</LI>
<LI><B>--nogcse</B>
<A NAME="--nogcse"></A>  Will not do global subexpression elimination, this option may
be used when the compiler creates undesirably large stack/data spaces to store
compiler temporaries. A warning message will be generated when this happens
and the compiler will indicate the number of extra bytes it allocated. It recommended
that this option NOT be used , #pragma NOGCSE can be used to turn off global
subexpression elimination for a given function only.</LI>
<LI><B>--noinvariant</B>
<A NAME="--noinvariant"></A>  Will not do loop invariant optimizations, this may be turned
off for reasons explained for the previous option . For more details of loop
optimizations performed see section Loop Invariants.It recommended that this
option NOT be used , #pragma NOINVARIANT can be used to turn off invariant
optimizations for a given function only.</LI>
<LI><B>--noinduction</B>
<A NAME="--noinduction"></A>  Will not do loop induction optimizations, see section Strength
reduction for more details.It recommended that this option NOT be used , #pragma
NOINDUCTION can be used to turn off induction optimizations for given function
only.</LI>
<LI><B>--nojtbound </B>
<A NAME="--nojtbound"></A>  Will not generate boundary condition check when switch statements
are implemented using jump-tables. See section Switch Statements for more details.It
recommended that this option NOT be used , #pragma NOJTBOUND can be used
to turn off boundary checking for jump tables for a given function only.</LI>
<LI><B>--noloopreverse</B> 
<A NAME="--noloopreverse"></A> Will not do loop reversal optimization</LI>
<LI><B>--noregparms</B>
<A NAME="--noregparms"></A>  By default the first parameter is passed using global registers
(DPL,DPH,B,ACC). This option will disable parameter passing using registers.
NOTE: if your program uses the 16/32 bit support routines (for multiplication/division)
these library routines will need to be recompiled with the --noregparms option
as well.</LI>
<LI><B>--callee-saves function1[,function2][,function3]....</B>
<A NAME="--callee-saves"></A> The compiler by default uses a caller saves convention for register saving
across function calls, however this can cause unneccessary register pushing
&amp; popping when calling small functions from larger functions. This option
can be used to switch the register saving convention for the function names
specified. The compiler will not save registers when calling these functions,
extra code will be generated at the entry &amp; exit for these functions to
save &amp; restore the registers used by these functions, this can SUBSTANTIALLY
reduce code &amp; improve run time performance of the generated code. In future
the compiler (with interprocedural analysis) will be able to determine the
appropriate scheme to use for each function call. DO NOT use this option for
built-in functions such as _muluint..., if this option is used for a library
function the appropriate library function needs to be recompiled with the same
option. If the project consists of multiple source files then all the source
file should be compiled with the same --callee-saves option string. Also see
Pragma Directive
<A HREF="SDCCUdoc-19.html#Pragmaa"></A> CALLEE-SAVES.
<A HREF="SDCCUdoc-19.html#pragma callee-saves"></A> .</LI>
<LI><B>--debug </B>
<A NAME="--debug"></A> When this option is used the compiler will generate debug information
, that can be used with the SDCDB. The debug information is collected in a
file with .cdb extension. For more information see documentation for SDCDB.</LI>
<LI><B>--regextend </B>
<A NAME="--regextend"></A>  This option will cause the compiler to define pseudo registers
, if this option is used, all source files in the project should be compiled
with this option. See section Register Extension for more details.</LI>
<LI><B>--compile-only</B>(-c) 
<A NAME="--compile-only"></A>  will compile and assemble the source only, will not
call the linkage editor.</LI>
<LI><B>--xram-loc </B>
<A NAME="--xram-loc"></A> &lt;Value&gt; The start location of the external ram, default
value is 0. The value entered can be in Hexadecimal or Decimal format .eg.
--xram-loc 0x8000 or --xram-loc 32768.</LI>
<LI><B>--code-loc </B>
<A NAME="--code-loc"></A> &lt;Value&gt; The start location of the code segment , default
value 0. Note when this option is used the interrupt vector table is also relocated
to the given address. The value entered can be in Hexadecimal or Decimal format
.eg. --code-loc 0x8000 or --code-loc 32768.</LI>
<LI><B>--stack-loc</B>
<A NAME="--stack-loc"></A> &lt;Value&gt; The initial value of the stack pointer. The default
value of the stack pointer is 0x07 if only register bank 0 is used, if other
register banks are used then the stack pointer is initialized to the location
above the highest register bank used. eg. if register banks 1 &amp; 2 are used
the stack pointer will default to location 0x18. The value entered can be in
Hexadecimal or Decimal format .eg. --stack-loc 0x20 or --stack-loc 32. If all
four register banks are used the stack will be placed after the data segment
(equivalent to --stack-after-data)</LI>
<LI><B>--stack-after-data</B>
<A NAME="--stack-after-data"></A> This option will cause the stack to be located in the
internal ram after the data segment.</LI>
<LI><B>--data-loc</B> 
<A NAME="--data-loc"></A> &lt;Value&gt; The start location of the internal ram data segment,
the default value is 0x30.The value entered can be in Hexadecimal or Decimal
format .eg. --data-loc 0x20 or --data-loc 32.</LI>
<LI><B>--idata-loc</B>
<A NAME="--idata-loc"></A> &lt;Value&gt; The start location of the indirectly addressable
internal ram, default value is 0x80. The value entered can be in Hexadecimal
or Decimal format .eg. --idata-loc 0x88 or --idata-loc 136.</LI>
<LI><B>--peep-file
<A NAME="--peep-file"></A>  </B>&lt;filename&gt; This option can be used to use additional
rules to be used by the peep hole optimizer. See section Peep Hole optimizations
for details on how to write these rules.</LI>
<LI><B>--lib-path (-L) </B>
<A NAME="--lib-path"></A> &lt;absolute path to additional libraries&gt; This option
is passed to the linkage editor, additional libraries search path. The path
name must be absolute. Additional library files may be specified in the command
line . See section Compiling programs for more details.</LI>
<LI><B>-I &lt;path&gt;
<A NAME="-I"></A> </B> The additional location where the pre processor will look
for &lt;..h&gt; or "..h" files.</LI>
<LI><B>-D&lt;macro[=value]&gt;</B> 
<A NAME="-D"></A> Command line definition of macros. Passed
to the pre processor.</LI>
<LI><B>-E</B>
<A NAME="-E"></A>  Run only the C preprocessor. Preprocess all the C source files specified
and output the results to standard output.</LI>
<LI><B>-M
<A NAME="-M"></A> </B> Tell the preprocessor to output a rule suitable for make describing
the dependencies of each object file. For each source file, the preprocessor
outputs one make-rule whose target is the object file name for that source
file and whose dependencies are all the files `#include'd in it. This rule
may be a single line or may be continued with `\'-newline if it is long.
The list of rules is printed on standard output instead of the preprocessed
C program. `-M' implies `-E'.</LI>
<LI><B>-C</B> 
<A NAME="-C"></A> Tell the preprocessor not to discard comments. Used with the `-E' option.</LI>
<LI><B>-MM </B>
<A NAME="-MM"></A> Like `-M' but the output mentions only the user header files included
with `#include file&quot;'. System header files included with `#include
&lt;file&gt;' are omitted.</LI>
<LI><B>-Aquestion(answer)</B>
<A NAME="-Aquestion(answer)"></A>  Assert the answer answer for question, in case it is
tested with a preprocessor conditional such as `#if #question(answer)'.
`-A-' disables the standard asser- tions that normally describe the target
machine.</LI>
<LI><B>-Aquestion</B>
<A NAME="-Aquestion"></A>  (answer) Assert the answer answer for question, in case it is
tested with a preprocessor conditional such as `#if #question(answer)'.
`-A-' disables the standard assertions that normally describe the target machine.</LI>
<LI><B>-Umacro</B>
<A NAME="-Umacro"></A>  Undefine macro macro. `-U' options are evaluated after all `-D'
options, but before any `-include' and `-imac- ros' options.</LI>
<LI><B>-dM</B>
<A NAME="-dM"></A>  Tell the preprocessor to output only a list of the mac- ro definitions
that are in effect at the end of prepro- cessing. Used with the `-E' option.</LI>
<LI><B>-dD</B> 
<A NAME="-dD"></A> Tell the preprocessor to pass all macro definitions into the output,
in their proper sequence in the rest of the output.</LI>
<LI><B>-dN </B>
<A NAME="-dN"></A> Like `-dD' except that the macro arguments and contents are omitted.
Only `#define name' is included in the output.</LI>
<LI><B>-S </B>
<A NAME="-S"></A> Stop after the stage of compilation proper; do not as- semble. The output
is an assembler code file for the input file specified.</LI>
<LI><B>-Wa asmOption[,asmOption]</B>... Pass the asmOption to the assembler</LI>
<LI><B>-Wl linkOption[,linkOption]</B> .. Pass the linkOption to the linker.</LI>
<LI><B>--int-long-reent</B> 
<A NAME="--int-long-rent"></A>  Integer (16 bit) and long (32 bit) libraries have been
compiled as reentrant. Note by default these libraries are compiled as non-reentrant.
See section Installation for more details.</LI>
<LI><B>--cyclomatic </B>
<A NAME="--cyclomatic"></A> This option will cause the compiler to generate an information
message for each function in the source file. The message contains some important
information about the function. The number of edges and nodes the compiler
detected in the control flow graph of the function, and most importantly the
cyclomatic complexity see section on Cyclomatic Complexity for more details.</LI>
<LI><B>--float-reent </B>
<A NAME="--float-reent"></A>  Floating point library is compiled as reentrant.See section
Installation for more details.</LI>
<LI><B>--out-fmt-ihx
<A NAME="--out-fmt-ihx"></A>  </B>The linker output (final object code) is in Intel Hex format.
(This is the default option).</LI>
<LI><B>--out-fmt-s19 </B>
<A NAME="--out-fmt-s19"></A> The linker output (final object code) is in Motorola S19
format.</LI>
<LI><B>--nooverlay</B> 
<A NAME="--nooverlay"></A>  The compiler will not overlay parameters and local variables
of any function, see section Parameters and local variables for more details.</LI>
<LI><B>--main-return</B>
<A NAME="--main-return"></A>  This option can be used when the code generated is called
by a monitor program. The compiler will generate a 'ret' upon return from the
'main' function. The default option is to lock up i.e. generate a 'ljmp .'
.</LI>
<LI><B>--no-peep</B> 
<A NAME="--no-peep"></A>  Disable peep-hole optimization.</LI>
<LI><B>--peep-asm</B> 
<A NAME="--peep-asm"></A>  Pass the inline assembler code through the peep hole optimizer.
Can cause unexpected changes to inline assembler code , please go through the
peephole optimizer rules defnied in file 'SDCCpeeph.def' before using this
option.</LI>
<LI><B>--iram-size</B>
<A NAME="--iram-size"></A>  &lt;Value&gt; Causes the linker to check if the interal ram
usage is within limits of the given value.</LI>
</UL>
<P>The following options are provided for the purpose of retargetting and
debugging the compiler . These provided a means to dump the intermediate code
(iCode) generated by the compiler in human readable form at various stages
of the compilation process. 
<P>
<UL>
<LI><B>--dumpraw </B>
<A NAME="--dumpraw"></A> . This option will cause the compiler to dump the intermediate
code into a file of named &lt;source filename&gt;.dumpraw just after the intermediate
code has been generated for a function , i.e. before any optimizations are
done. The basic blocks at this stage ordered in the depth first number, so
they may not be in sequence of execution.</LI>
<LI><B>--dumpgcse</B>.
<A NAME="--dumpgcse"></A>  Will create a dump if iCode, after global subexpression elimination,
into a file named &lt;source filename&gt;.dumpgcse.</LI>
<LI><B>--dumpdeadcode </B>
<A NAME="--dumpdeadcode"></A> .Will create a dump if iCode, after deadcode elimination,
into a file named &lt;source filename&gt;.dumpdeadcode.</LI>
<LI><B>--dumploop.</B> 
<A NAME="--dumploop"></A> Will create a dump if iCode, after loop optimizations, into
a file named &lt;source filename&gt;.dumploop.</LI>
<LI><B>--dumprange.</B> 
<A NAME="--dump-range"></A> Will create a dump if iCode, after live range analysis, into
a file named &lt;source filename&gt;.dumprange.</LI>
<LI><B>--dumpregassign. </B>
<A NAME="--dumpregassign"></A> Will create a dump if iCode, after register assignment
, into a file named &lt;source filename&gt;.dumprassgn.</LI>
<LI><B>--dumpall. </B>
<A NAME="--dumpall"></A> Will cause all the above mentioned dumps to be created.</LI>
</UL>
<P>Note that the files created for the dump are appended to each time. So
the files should be deleted manually , before each dump is created. 
<P>When reporting bugs, it will be very helpful if you could include these
dumps along with the portion of the code that is causing the problem.
<HR>
<A HREF="SDCCUdoc-5.html">Next</A>
<A HREF="SDCCUdoc-3.html">Previous</A>
<A HREF="SDCCUdoc.html#toc4">Contents</A>
</BODY>
</HTML>
